package com.hz.handler;

import com.hz.pojo.Three;
import com.hz.service.ThressService;
import com.hz.utils.ResultData;
import com.hz.utils.ResultUtils;
import com.hz.utils.ThreeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/three")
public class ThreeC {
    @Autowired
    private ThressService service;

    @GetMapping("/list")
    public ResultData listall() {
        List<Three> res = service.listall();
//        ThreeUtils thr=new ThreeUtils();
//        thr.data(res);
        if (res != null) {
            //登录成功的话创建一个token封装到res对象中
            return ResultUtils.sucuss("查询成功", res);
        } else {
            return ResultUtils.error("添加失败", null);
        }
    }
}
